package product;

import java.sql.CallableStatement;
import java.sql.Connection;  
import java.sql.DriverManager;  
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Types;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class SqlServerConnectionUtil {  
	public static Connection getConnection() {  
	  String driverName = "com.microsoft.sqlserver.jdbc.SQLServerDriver";  
	  String dbURL = "jdbc:sqlserver://192.168.50.210:1433;databaseName=aofenggas";  
	  String userName = "sa";  
	  String userPwd = "000000";  
	  Connection dbConn = null;  
	  try {  
	   Class.forName(driverName);  
	   dbConn = DriverManager.getConnection(dbURL, userName, userPwd);  
	   System.out.println("连接数据库成功");  
	   return dbConn;  
	  } catch (Exception e) {  
	   e.printStackTrace();  
	   System.out.print("连接失败");  
	  }  
	  return dbConn;  
	 }
}


